package com.lm.activiti.boot.cases;

/**
 * @author lm_jcf
 * @date 2021/2/26 11:13
 */
public class ObjectCase {

    private static ObjectCase objectCase = new ObjectCase();

    private static int count = 0;

    private static int sum = 1;

    public ObjectCase() {
        count++;
        sum++;
    }

    public static ObjectCase getInstance(){
        return objectCase;
    }

    public void sout(){
        System.out.println(count);
        System.out.println(sum);
    }


    public static void main(String[] args) {
       /* Parent parent = new Parent();

        parent.income(parent);

        System.out.println(parent.age);


        Child child = new Child();
        Child child2 = new Child();*/

        ObjectCase.getInstance().sout();
    }
}

class Parent{

    public int age;

    public void say(){
        System.out.println("parent");
    }

    public Parent income(Parent parent) {
        try {
            parent.age = 18;
            throw new Exception();
//            return parent;
        } catch (Exception e) {

            System.out.println("ce");
            parent.age = 0;
            return null;
        }finally {
            parent.age = 20;
            return parent;
        }
    }
}

class Child extends Parent{

    static {
        System.out.println("静态块");
    }

    public static void stMe(){
        System.out.println("静态方法");
    }

    {
        System.out.println("代码块");
    }

    Child(){
        System.out.println("构造");
    }

    public void eat(){
        System.out.println("child");
    }
}


